#include <iostream>
using namespace std;

int main()
{
    int year, month, day;
    cin >> year >> month >> day;
    int sum = 0;
    int arr[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
    if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
    {
        arr[2]++;
    }
    month--;
    while (month)
    {
        sum += arr[month];
        month--;
    }
    sum += day;
    return sum;
}